import React from "react";
import { Route } from "react-router-dom";
import {
  Login,
  DashboardIndex,
  Rule,
  User,
  ApplyAll,
  AuditAll,
  ReviewAll,
  BorrowAll,
  ApprovedAll,
  WorkbenchIndex,
  OrderAll,
  ForLending,
  OrderRollOver,
  Deductions,
  Repayment,
  Extension,
  OverLimit,
  Collection,
  Register,
  MarketRisk,
  Execution,
  Strategy,
  RiskRule,
  Field,
  Mine,
  Banner,
  Traffic,
  Message,
  Platform,
  CustomerService,
  Financial,
  Analysis,
  Setup,
  ChannelStatistical,
  Data,
  Info,
  MoneyStatistical,
  Statement
} from "./utils/router_components";

const routes = [
  { path: "/", component: Login, exact: true },
  {
    path: "/login",
    component: Login
  },
  {
    path: "/dashboard",
    component: DashboardIndex,
    routes: [
      {
        path: "/dashboard/home", //看板页
        component: WorkbenchIndex
      },
      {
        path: "/dashboard/apply.all", //申请管理-全部
        component: ApplyAll
      },
      {
        path: "/dashboard/apply.audit", //申请管理-待审核
        component: AuditAll
      },
      {
        path: "/dashboard/apply.review", //申请管理-审核中
        component: ReviewAll
      },
      {
        path: "/dashboard/apply.borrow", //申请管理-复借列表
        component: BorrowAll
      },
      {
        path: "/dashboard/apply.approved", //申请管理-已审核
        component: ApprovedAll
      },
      {
        path: "/dashboard/order.all", //订单管理-全部订单
        component: OrderAll
      },
      {
        path: "/dashboard/order.forlending", //订单管理-待放款订单
        component: ForLending
      },
      {
        path: "/dashboard/order.rollover", //订单管理-展期订单
        component: OrderRollOver
      },
      {
        path: "/dashboard/extension.record", //订单管理-展期记录
        component: Extension
      },
      {
        path: "/dashboard/deductions.record", //订单管理-扣款记录
        component: Deductions
      },
      {
        path: "/dashboard/repayment.record", //订单管理-还款记录
        component: Repayment
      },
      {
        path: "/dashboard/over.limit", //催收管理-逾期订单
        component: OverLimit
      },
      {
        path: "/dashboard/collection", //催收管理-催收订单
        component: Collection
      },
      {
        path: "/dashboard/user.register", //用户管理-注册用户
        component: Register
      },
      {
        path: "/dashboard/market.risk", //风险管理-风险大盘
        component: MarketRisk
      },
      {
        path: "/dashboard/execution.risk", //风险管理-执行记录
        component: Execution
      },
      {
        path: "/dashboard/strategy.risk", //风险管理-策略集
        component: Strategy
      },
      {
        path: "/dashboard/rule.risk", //风险管理-规则配置
        component: RiskRule
      },
      {
        path: "/dashboard/field.risk", //风险管理-字段维护
        component: Field
      },
      {
        path: "/dashboard/operating.mine", //运营管理-我的业务
        component: Mine
      },
      {
        path: "/dashboard/operating.banner", //运营管理-Banner设置
        component: Banner
      },
      {
        path: "/dashboard/operating.traffic", //运营管理-流量分单设置
        component: Traffic
      },
      {
        path: "/dashboard/operating.msg", //运营管理-消息管理
        component: Message
      },
      {
        path: "/dashboard/operating.platform", //运营管理-平台转化率
        component: Platform
      },
      {
        path: "/dashboard/operating.customer", //运营管理-客服转化率
        component: CustomerService
      },
      {
        path: "/dashboard/operating.financial", //运营管理-财务对账
        component: Financial
      },
      {
        path: "/dashboard/operating.analysis", //运营管理-数据分析
        component: Analysis
      },
      {
        path: "/dashboard/channel.setup", //渠道管理-渠道设置
        component: Setup
      },
      {
        path: "/dashboard/channel.statistical", //渠道管理-渠道统计
        component: ChannelStatistical
      },
      {
        path: "/dashboard/channel.data", //渠道管理-渠道数据
        component: Data
      },
      {
        path: "/dashboard/product.info", //产品管理-产品信息
        component: Info
      },
      {
        path: "/dashboard/money.statistical", //资金管理-资金统计
        component: MoneyStatistical
      },
      {
        path: "/dashboard/money.statement", //资金管理-消费明细
        component: Statement
      },
      {
        path: "/dashboard/system.user", //系统管理-用户管理
        component: User
      },
      {
        path: "/dashboard/system.rule", //系统管理-角色管理
        component: Rule
      }
    ]
  }
];
const RouteWithSubRoutes = route => (
  <Route
    path={route.path}
    exact={route.exact}
    render={props => <route.component {...props} routes={route.routes} />}
  />
);
export { routes, RouteWithSubRoutes };
